package top.vains.controller;

import io.swagger.annotations.Api;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import top.vains.entity.Result;
import top.vains.enumeration.ResultEnum;
import top.vains.util.ResultUtils;

/**
 * 404异常接口
 * @author vains
 * @date 2020/4/2
 */
@RestController
@Api(tags = "异常接口，处理项目访问接口出现404")
public class NotFoundController implements ErrorController {

    private static final String ERROR_PATH = "/error";

    @Override
    public String getErrorPath() {
        return ERROR_PATH;
    }

    @GetMapping(ERROR_PATH)
    public Result error(){
        return ResultUtils.error(ResultEnum.NOT_FOUND.getCode(), "访问路径不存在，请检查后重试！");
    }
}
